package net.dreamlu.qa.model;

import java.util.Date;

import com.jfinal.plugin.activerecord.Model;

/**
 * 问题分类Model
 * @author lcm
 */
public class QuestionSort extends Model<QuestionSort> {
	private static final long serialVersionUID = 1L;
	public static final QuestionSort dao = new QuestionSort();
	
	// 添加问题的统一处理
	public void addQuestionSort(QuestionSort questionSort){
		questionSort.set("create_time", new Date()).set("update_time", new Date()).save();
	}
	// 更新问题统一处理
	public void updateQuestionSort(QuestionSort questionSort){
		questionSort.set("update_time", new Date()).update();
	}
	
	// 获取父分类
	public QuestionSort getParentSort(){
		return QuestionSort.dao.findById(get("parent_id"));
	}
	
}